<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>
<%--<%@include file="head.jsp"%>--%>
<link href="/plugins/bootstrap/bootstrap.css" rel="stylesheet">
<link href="/plugins/jquery-ui/jquery-ui.min.css" rel="stylesheet">
<%--<link href="http://maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css" rel="stylesheet">--%>
<%--<link href='http://fonts.googleapis.com/css?family=Righteous' rel='stylesheet' type='text/css'>--%>
<link href="/plugins/fancybox/jquery.fancybox.css" rel="stylesheet">
<link href="/plugins/fullcalendar/fullcalendar.css" rel="stylesheet">
<link href="/plugins/xcharts/xcharts.min.css" rel="stylesheet">
<link href="/plugins/select2/select2.css" rel="stylesheet">
<link href="/plugins/justified-gallery/justifiedGallery.css" rel="stylesheet">
<link href="/css/style_v1.css" rel="stylesheet">
<link href="/css/jquery.bootgrid.min.css" rel="stylesheet">
<link href="/plugins/chartist/chartist.min.css" rel="stylesheet">
<!--Start Breadcrumb-->
<div class="row">
	<div id="breadcrumb" class="col-xs-12">
	<a href="#" class="show-sidebar">
						  <i class="fa fa-bars"></i>
						</a>
		<ol class="breadcrumb pull-left">
			<li><a href="../index.jsp">首页</a></li>
			<li><a href="#">已部署的工作流</a></li>
		</ol>
	</div>
</div>
<div class="container-fluid">
	<div class="row">
		<div class="col-lg-12">
		<div class="box ui-draggable ui-droppable">
			<div class="box-header">
					<div class="box-name">
						<i class="fa fa-coffee"></i> <span>上传工作流文件</span>
					</div>
					<div class="box-icons">
						<a class="collapse-link"> <i class="fa fa-chevron-up"></i>
						</a> <a class="expand-link"> <i class="fa fa-expand"></i>
						</a> <a class="close-link"> <i class="fa fa-times"></i>
						</a>
					</div>
					<div class="no-move"></div>
				</div>
				<div class="box-content">
					<form id="upload" action="${rc.contextPath}/activiti/uploadworkflow.do" method="post" enctype="multipart/form-data">
						<div class="form-group">
							<label for="fileupload">workflowupload</label> 
							<input type="file" name="uploadfile" class="form-control" id="fileupload">
						</div>
						<button type="submit" class="btn btn-primary">upload</button>
					</form>
				</div>
			</div></div>
		</div>
		
	<!-- /.row -->
	<div class="row">
		<div class="col-lg-12">
		<div class="box ui-draggable ui-droppable">
				<div class="box-header">
					<div class="box-name">
						<i class="fa fa-coffee"></i> <span>已部署的工作流</span>
					</div>
					<div class="box-icons">
						<a class="collapse-link"> <i class="fa fa-chevron-up"></i>
						</a> <a class="expand-link"> <i class="fa fa-expand"></i>
						</a> <a class="close-link"> <i class="fa fa-times"></i>
						</a>
					</div>
					<div class="no-move"></div>
				</div>
				<div class="box-content">
					<table id="grid-data" class="table table-condensed table-hover table-striped">
						<thead>
							<tr>
								<th data-column-id="id" data-formatter="run"
									data-identifier="true" data-type="numeric">ID</th>
								<th data-column-id="deploymentId">DeploymentId</th>
								<th data-column-id="name">name</th>
								<th data-column-id="resourceName" data-formatter="resname">ResourceName</th>
								<th data-column-id="diagramresourcename"
									data-formatter="picname">diagramResourceName</th>
								<th data-column-id="key">key</th>
								<th data-column-id="commands" data-formatter="commands"
									data-sortable="false">操作</th>
							</tr>
						</thead>
					</table>
				</div></div>
		</div>
		</div>
		</div>
<%--<%@include file="foot.jsp"%>--%>
<!--End Container-->
<!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
<!--<script src="http://code.jquery.com/jquery.js"></script>-->
<script src="/plugins/jquery/jquery.min.js"></script>
<script src="/plugins/jquery-ui/jquery-ui.min.js"></script>
<!-- Include all compiled plugins (below), or include individual files as needed -->
<script src="/plugins/bootstrap/bootstrap.min.js"></script>
<script src="/plugins/justified-gallery/jquery.justifiedGallery.min.js"></script>
<script src="/plugins/tinymce/tinymce.min.js"></script>
<script src="/plugins/tinymce/jquery.tinymce.min.js"></script>
<script src="/js/jquery.bootgrid.min.js"></script>
<!-- All functions for this theme + document.ready processing -->
<script src="/js/devoops.js"></script>
<%--<script src="../../../static/lib/jquery.min.js"></script>--%>
<script type="text/javascript">
	$(document).ready(function(){
	  $("#upload").submit(function(){
	    if($("#fileupload").val()=="")
	    {
	    	alert("请选择工作流文件上传");
	    	return false;
	    }
	  });
	  
  });
  $(document).ready(function(){
	    var grid =$("#grid-data").bootgrid({
	    ajax:true,
			post:true,
	    rowCount:10,
	    navigation:2,
	    columnSelection:false,
	    url:"../../activiti/getprocesslists.do",
	        formatters: {
	        "commands": function(column, row)
	        {
	            return "<button type=\"button\" class=\"btn btn-xs btn-info command-delete\" data-row-id=\"" + row.deploymentId + "\">删除</button>";
	        },
	        "resname":function(column, row)
	        {
	            return "<a target=\"_blank\" href=\"${rc.contextPath}/activiti/showresource.do?pdid="+row.id+"&resource="+row.resourceName+"\">"  + row.resourceName + "</a>";
	        },
	        "picname":function(column, row)
	        {
	        	return "<a target=\"_blank\" href=\"${rc.contextPath}/activiti/showresource.do?pdid="+row.id+"&resource="+row.diagramresourcename+"\">"  + row.diagramresourcename + "</a>";
	        },
	    	}
	    }).on("loaded.rs.jquery.bootgrid", function()
		{
		    grid.find(".command-delete").on("click", function(e)
			    {
			        $.post("../../activiti/deletedeploy.do",{deployid:$(this).data("row-id")},function(){
			        	alert("删除成功");
			        	$("#grid-data").bootgrid("reload");
			        });
			    });
		    });
	  });
  </script>


